package Thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Runnable r1 = new jack();
        Runnable r2 = new rose();
        Thread Rose = new Thread(r1);
        Thread Jack = new Thread(r2);
        Rose.start();
        Jack.setDaemon(true);
        Jack.start();
    }
}

class jack implements Runnable {
        public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println("rose:let me go!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("rose:啊啊啊啊啊啊AAAAAAAlaa....");
        System.out.println("噗通");
    }
}

class rose implements Runnable {
    public void run() {
        while (true) {
            System.out.println("jack:you jump!i jump!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

